<div class="homepage">
	<div id="search-panel"></div>
	<div id="cat"></div>
</div>
<script>
	var counter = counter || 0;
	var loader = new ContentLoader();
	!function() {
		loader.viewCategory = function(cat) {
			window.location.hash = '#' + cat;
			this.showPreloader();
			var loadOffers = function(data) {
				if (data != undefined && data != null) {
					if (data.users.length != 0) {
						$('#main-container').empty();
						for ( var user in data.users) {
							if (data.users.hasOwnProperty(user)) {
								var offerDiv = $('<div />');
								offerDiv.addClass('offer-item');

								var userName = $('<span />', {
									text : user + ' : '
								});
								userName.addClass('offer-item-username');
								$(offerDiv).append($(userName));

								for ( var i in data.users[user]) {
									var userOffer = $('<span />');
									$(userOffer).text('#' + data.users[user][i] + ' ');
									userOffer.addClass('offer-item-offer')
									$(offerDiv).append($(userOffer));
									var o = data.users[user][i];
									$(userOffer).attr('onclick',
											'loader.viewCategory(this.innerText.substr(1,this.length));');
								}

								var contactMe = $('<div id="contact-me" class="button" onclick="(new MessageHandler()).openEditor(\''
										+ user + '\');"><span>Contact Me!</span></div>');
								$(offerDiv).append($(contactMe));

								$('#main-container').append($(offerDiv));
							}
						}
					}
				}
			}
			$.ajax({
				url : '/s/?action=load_content',
				data : 'cat=' + cat,
				success : loadOffers
			});
		}
		loader.loadCategories();
	}()
</script>